package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojo.User;
import org.springframework.kafka.annotation.KafkaListener;

//@Component
public class HelloListener {

    @KafkaListener(topics = "order")
    public void onMessage(String msg){
        System.out.println(msg);
    }

    @KafkaListener(topics = "obj")
    public void onMessageObject(String msg){
        System.out.println(msg);

        User user = JSON.parseObject(msg, User.class);
        System.out.println(user);
    }
}
